<?php
/**
 * bs多规格sku商城系统
 * ============================================================================
 * 版权所有 2024-2099 wltx666.com，并保留所有权利。
 * 网站地址: https://wltx666.com
 * ============================================================================
 * Author: 草上飞
 * Email: wltx@alipay168.cn
 * QQ: 2719875001
 * Date: 2024/12/18
 * 描述:
 */

namespace app\api\controller;

use app\result\PaymentResult;
use think\App;

class Payment extends BaseIndex
{

    protected $unauthorized = ['payment@cashier'];

    public function __construct(App $app)
    {
        parent::__construct($app);
        $this->objResult = new PaymentResult();
    }

    // 支付方式列表
    public function payment_list()
    {
        data_return('success', 0, $this->objResult->payment_list($this->user_id, $this->param));
    }

    public function pay()
    {
        $this->param['token'] = $this->token;
        data_exit_json($this->objResult->pay($this->user_id, $this->param));
    }



    //收银台
    public function cashier()
    {
        //关闭调试
        $this->app->debug(false);
        // Config::set('app.app_debug', false);

        return view('index/payment/cashier');
    }

    public function cashier_query()
    {
        $order_sn = $this->param['order_sn'] ?? '';
        if (empty($order_sn)) {
            data_return('订单号不能为空', 1);
        }
        $res = $this->objResult->cashier_query($this->param);
        data_exit_json($res);
    }

    public function cashier_pay()
    {
        $order_sn = $this->param['order_sn'] ?? '';
        if (empty($order_sn)) {
            data_return('订单号不能为空', 1);
        }
        $res = $this->objResult->cashier_pay($this->param);
        data_exit_json($res);
    }


}
